<?php session_start();
echo '<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Welcome to DormBase!</title>

	<link href="style.css" rel="stylesheet" type="text/css" />
	<style type="text/css">
	.indexError {
		text-align: left;
	}
	</style>
	</head>
	
	<body>
	
	<table width="100%" border="0" cellpadding="1">
	  <tr>
		<th scope="col">&nbsp;</th>
		<th width="80%" scope="col">
			<img src="test.gif" width="900" height="120" alt="banner" /></th>
		<th scope="col">&nbsp;</th>
		
	  </tr>
	  <tr>
		<td>&nbsp;</td>
		<td><b><center>';
	 
	if(isset($_GET['message']))
	{
	switch($_GET['message'])
	{
	case 'success':echo "Log Out Successful!"; session_destroy(); break;
	case 'error':echo "Try Again"; session_destroy(); break;
	}
	}
    ?>
		</center></b></td>
		<td>&nbsp;</td>
	  </tr>
	  <tr>
		<td>&nbsp;</td>
		<td><form id="form1" name="login" method="post" action="" >
		  <p>&nbsp;</p>
		  <table width="100%" border="0" cellpadding="1">
			<tr>
			  <td width="37%"><strong>Username</strong></td>
			  <td width="34%"><input name="uname" type="text" id="uname" size="40" />
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
			  <td width="29%" class="error" id="uname">&nbsp;</td>
			</tr>
			<tr>
			  <td><strong>Password</strong></td>
			  <td><input name="pword" type="password" id="pword" size="40" />
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
			  <td class="error" id="pwd">&nbsp;</td>
			</tr>
			<tr>
			  <td>&nbsp;</td>
			  <td><input type="submit" name="Login" id="Login" value="Log In" />
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
			  <td class="error">&nbsp;</td>
			</tr>
			<tr>
			  <td>&nbsp;</td>
			  <td>&nbsp;</td>
			  <td class="error">&nbsp;</td>
			</tr>
	  </table>
	  </form></td>
		<td>&nbsp;</td>
	  </tr>
	  <tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	  </tr>
	</table>
	</body>
	</html>
	<?php
	require_once 'PIView.php';
	if(isset($_POST['Login']))
	{
		$userInput = $_POST['uname'];
		$userPword = $_POST['pword'];
		$_SESSION['username']=$_POST['uname'];
		$_SESSION['password']=$userPword;
		PIView::checkUsers($userInput,$userPword);
	}

	?>